package org.jetlinks.pro.assets;

import io.swagger.v3.oas.annotations.media.Schema;
import lombok.*;
import org.hswebframework.web.authorization.Authentication;
import org.hswebframework.web.authorization.Dimension;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.util.List;

@Getter
@Setter
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class AssetBindRequest {
    /**
     * 维度类型，例如：机构
     *
     * @see Dimension#getType()
     * @see Authentication#getDimensions(String)
     */
    @Schema(description = "维度类型")
    @NotBlank
    private String targetType;

    /**
     * 维度ID，类型对应的实例ID，如：机构ID
     * @see Dimension#getId()
     * @see Authentication#getDimension(String, String)
     */
    @Schema(description = "维度ID")
    @NotBlank
    private String targetId;

    /**
     * 资产类型
     * @see AssetType#getId()
     * @see Asset#getType()
     */
    @Schema(description = "资产类型")
    @NotBlank
    private String assetType;

    /**
     * 资产ID
     * @see Asset#getId()
     */
    @Schema(description = "资产ID")
    @NotNull
    private List<String> assetIdList;

    /**
     * @see AssetType#getPermissions()
     */
    @Schema(description = "授权信息")
    private List<String> permission;

    @Schema(description = "是否赋予全部权限")
    private boolean allPermission;

    @Schema(description = "与资产的关系")
    private String relation;

}
